@extends('admin.layout')
@section('title',$title)
@section('content')
    <div class="content-wrapper">
        <section class="content-header">
            <h1>
                分类管理
                <small>在这里，你可以添加分类
                @if(session('info'))
                       <span style="color: red;" class="edit">{{session('info')}}</span>     
                @endif
                </small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{ url('/admin/user/index')}}"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="{{ url('/admin/user/add')}}">分类管理</a></li>
                <li class="active">添加分类</li>
            </ol>
        </section>  

        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header ">
                            <h3 class="box-body">快速添加分类</h3>
                        </div><!-- /.box-header -->
                        
                        <!-- form start -->
                        <form role="form" action="{{ url('/admin/type') }}" method="post" enctype="multipart/form-data">
                        {{ csrf_field() }}
                        <div class="form-group">
                            <label>父类</label>
                            <select class="form-control" name="pid">
                            <option value="0">根类</option>
                             @foreach($data as $row)
                                 <option value="{{$row -> tid}}">{{$row -> tname}}</option>
                             @endforeach
                            </select>
                        </div>  
                            <div class="box-body">
                                <div class="form-group">
                                    <label for="exampleInputEmail1">子类名称</label>
                                    <input type="text" class="form-control" id="exampleInputEmail1" name="tname" 
                                           placeholder="请输入要添加的子类名称">
                                </div>
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">添加</button>
                            </div>
                        </form>
                    </div><!-- /.box -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
    <script>
        window.onload = function()
        {
            $('.edit').fadeOut(2000);
        }
    </script>
@endsection